// page/mall/course_detial.js
Page({
  data: {
    isHide: 0,
    imgUrls:[],
    indicatorDots: true,
    indicatorColor: "rgba(255,255,255,.3)",
    indicatorActiveColor: "rgba(255,255,255,1)",
    autoplay: true,
    interval: 5000,
    duration: 1000,
    course: {},
    tpl:'',
    title:''
  },

  onLoad: function (options) {     
      var that = this;  
      // wx.request({
      //   url: app.globalData.host + '&g=App&m=Item&a=info',
      //   data: { id: that.data.options.id },
      //   header: {
      //     'content-type': 'application/json'
      //   },
      //   success: function (res) {
      //     that.setData({
      //       title: res.data.ad.title
      //     })
      //   }
      // })
      that.setData({
        options: options,
      })
  },
  onShow:function(){
    var app = getApp()
    var that = this;
    wx.request({
      url: app.globalData.host + '&g=App&m=Item&a=info',
      data: { id: that.data.options.id},
      header: {
        'content-type': 'application/json'
      },
      // tpl: that.data.ad.tpl,   
      success: function (res) {
        console.log(res.data)
        that.setData({
          bannerItem: res.data.ad.banner,
          ad: res.data.ad,
          imgUrl: res.data.ad.imgs,
          tpl: res.data.ad.tel,
          title: res.data.ad.title
        })
        // console.log(that.data.ad)
        wx.setNavigationBarTitle({
          title: that.data.ad.title,
        }) 
      }
    }),
      
    that.setData({
      isHide: 1,
    })
  },
  bindPhoneCall: function (e) {
    this.setData({
      tpl: e.currentTarget.dataset.tpl
    })
    // console.log(e.currentTarget.dataset.tpl)
    wx.makePhoneCall({
      phoneNumber: this.data.tpl,  //电话号码
    })
  }
    
})